function sev (){

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH_BAK:
    export PATH=$PATH_BAK
    export C_INCLUDE_PATH=$C_INCLUDE_PATH_BAK   
    export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH_BAK
    export LDFLAGS=$LDFLAGS_BAK
    export CPATH=$CPATH_BAK
    module purge 

    if [[ impi-2019 == ${1} ]]; then
        module add compiler/intel/2019.4.243 mpi/intelmpi/2019.4.243 compiler/devtoolset/7.3.1  
        export CC=`which icc`; export CXX=`which icpc`;
        export MPI_C_COMPILER_INCLUDE_DIRS=/public/software/mpi/intelmpi/2019.4.243/intel64/intel64/include
        echo MPI_C_COMPILER_INCLUDE_DIRS=$MPI_C_COMPILER_INCLUDE_DIRS
        if [[ -f makefile.setup ]]; then
            sed -i "/^SYS/cSYS = linux.opteron" makefile.setup
        fi
        module add mathlib/hdf5/1.8.20/intel compiler/rocm/4.0.1 
    elif [[ impi-2021 == ${1} ]]; then
        module load compiler/intel/2017.5.239 mpi/intelmpi/2021.1.1 compiler/devtoolset/7.3.1
        export CC=`which icc`; export CXX=`which icpc`; 
        export I_MPI_PMI_LIBRARY=/public/software/mpi/intelmpi/2021.1.1/lib/release/libmpi.so
        if [[ -f makefile.setup ]]; then
            sed -i "/^SYS/cSYS = linux.opteron" makefile.setup
        fi
        module add mathlib/hdf5/1.8.20/intel compiler/rocm/4.0.1 
    elif [[ impi-2017 == ${1} ]]; then
        module load compiler/intel/2017.5.239 mpi/hpcx/2.4.1/intel-2017.5.239 #compiler/devtoolset/7.3.1
        export I_MPI_PMI_LIBRARY=/public/software/mpi/intelmpi/2017.4.239/intel64/lib/libmpi.so
        export CC=`which mpicc` 
        export CXX=`which mpicxx` 
        export FC=`which mpifort`
        export MPIEXEC=`which mpirun`
        if [[ -f makefile.setup ]]; then
            sed -i "/^SYS/cSYS = linux.opteron" makefile.setup
        fi
        module add mathlib/hdf5/1.8.20/intel compiler/rocm/4.0.1 
    elif [[ ompi == ${1} ]]; then
        echo ---------------------------------------------------------------------------------------------------
        echo module purge
        echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
        echo "LIBRARY_PATH=$LIBRARY_PATH"
        echo "PATH=$PATH"
        echo "CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH"
        echo "C_INCLUDE_PATH=$C_INCLUDE_PATH"
        echo ---------------------------------------------------------------------------------------------------

        echo ---------------------------------------------------------------------------------------------------
        echo module add  compiler/devtoolset/7.3.1   mpi/openmpi/4.0.4/gcc-7.3.1

        #module add  compiler/devtoolset/7.3.1      mpi/hpcx/2.7.4/gcc-7.3.1 #     mathlib/hdf5/1.8.20/gcc      compiler/rocm/3.9.1
       #module add  compiler/devtoolset/7.3.1   mpi/openmpi/4.0.4/gcc-7.3.1

        echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
        echo "LIBRARY_PATH=$LIBRARY_PATH"
        echo "PATH=$PATH"
        echo "CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH"
        echo "C_INCLUDE_PATH=$C_INCLUDE_PATH"
        echo ---------------------------------------------------------------------------------------------------

        export CC=`which mpicc` 
        export CXX=`which mpicxx` 
        export FC=`which mpifort`
        export MPIEXEC=`which mpirun`
        if [[ -f makefile.setup ]]; then
            sed -i "/^SYS/cSYS = gcc" makefile.setup
        fi

    else
 #      echo ---------------------------------------------------------------------------------------------------
 #      echo module purge
 #      echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
 #      echo "LIBRARY_PATH=$LIBRARY_PATH"
 #      echo "PATH=$PATH"
 #      echo "CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH"
 #      echo "C_INCLUDE_PATH=$C_INCLUDE_PATH"
 #      echo ---------------------------------------------------------------------------------------------------

 #      echo ---------------------------------------------------------------------------------------------------
 #      echo module add compiler/devtoolset/7.3.1:
 #      module add compiler/devtoolset/7.3.1
 #      echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
 #      echo "LIBRARY_PATH=$LIBRARY_PATH"
 #      echo "PATH=$PATH"
 #      echo "CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH"
 #      echo "C_INCLUDE_PATH=$C_INCLUDE_PATH"
 #      echo "LDFLAGS=$LDFLAGS"
 #      echo ---------------------------------------------------------------------------------------------------

#       export CC=`which mpicc` 
#       export CXX=`which mpicxx` 
#       export FC=`which mpifort`
#       export MPIEXEC=`which mpirun`


        export gccDir=${HOME}/Modules/gcc-9.4.0 
#       export ompiDir=${HOME}/Modules/openmpi-4.1.4

        export PATH=$gccDir/bin/:$PATH_BAK
        export LD_LIBRARY_PATH=/opt/hpc/software/mpi/hpcx/v2.11.0/ucx_without_rocm/lib:$gccDir/lib:$gccDir/lib64:$LD_LIBRARY_PATH_BAK
        export LIBRARY_PATH=/opt/hpc/software/mpi/hpcx/v2.11.0/ucx_without_rocm/lib
        export CPLUS_INCLUDE_PATH=$gccDir/include/c++/9.4.0/

        if [[ ${PETSC_DIR} ]]; then
            export PATH=${PETSC_DIR}/bin:$PATH
            export LD_LIBRARY_PATH=${PETSC_DIR}/lib:$LD_LIBRARY_PATH
            export LIBRARY_PATH=${PETSC_DIR}/lib:$LIBRARY_PATH
            export CPLUS_INCLUDE_PATH=${PETSC_DIR}/include:$CPLUS_INCLUDE_PATH
        fi
        if [[ ${USRLIB_DIR} ]]; then
            export PATH=${USRLIB_DIR}/bin:$PATH
            export LD_LIBRARY_PATH=${USRLIB_DIR}/lib:$LD_LIBRARY_PATH
            export LIBRARY_PATH=${USRLIB_DIR}/lib:$LIBRARY_PATH
            export CPLUS_INCLUDE_PATH=${USRLIB_DIR}/include:$CPLUS_INCLUDE_PATH
        fi

        export LDFLAGS=""

        unset C_INCLUDE_PATH; unset CPATH


#       export CC=`which mpicc` 
#       export CXX=`which mpicxx` 
#       export FC=`which mpifort`
        export MPIEXEC=`which mpirun`
        export CC=`which gcc` 
        export CXX=`which g++` 
        export FC=`which gfortran`

 #      echo ---------------------------------------------------------------------------------------------------
 #      echo "Using custom compiler and MPI: gcc=$gccDir mpi=$ompiDir"
 #      echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
 #      echo "LIBRARY_PATH=$LIBRARY_PATH"
 #      echo "PATH=$PATH"
 #      echo "CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH"
 #      echo "C_INCLUDE_PATH=$C_INCLUDE_PATH"
 #      echo ---------------------------------------------------------------------------------------------------

#       export PETSC_DIR=${HOME}/LIB
#       export PETSC_ARCH=""
        if [[ -f makefile.setup ]]; then
            sed -i "/^SYS/cSYS = gcc" makefile.setup
        fi
    #   module add mathlib/hdf5/1.8.20/intel compiler/rocm/4.0.1 
    fi

 #  module rm compiler/devtoolset/7.3.1
    module list
    echo -e "CC=$CC; CXX=$CXX; FC=$FC\nMPIEXEC=$MPIEXEC\nI_MPI_PMI_LIBRARY=$I_MPI_PMI_LIBRARY"
    echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
    echo "LIBRARY_PATH=$LIBRARY_PATH"
    echo "PATH=$PATH"
    echo "CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH"
    echo "C_INCLUDE_PATH=$C_INCLUDE_PATH"
}

export qLogFile=${HOME}/qlog.log
export qHisFile=${HOME}/qhis.log

function mqsub () {
    if [[ `find -type f -name "hostfile.*"` ]]; then return 0; fi;
    if [[ -f Finish ]]; then return 0; fi;
    jobName=$(basename `pwd`)
    curDir=`pwd`
    ncpus=4;
    nnodes=1;
    jobFile=${HOME}/job-paradis-DWei.sh;
    softDir=${HOME}/DWei/paradis;
    ctrlFile=`(find -type f -name "*.ctrl" && find -type f -name "rs[0-9][0-9][0-9][0-9]" && find -type f -name "restart.cn") | xargs ls -t | head -n 1`
    dataFile=`(find -type f -name "*.data" && find -type f -name "rs[0-9][0-9][0-9][0-9].data" && find -type f -name "restart.data") | xargs ls -t | head -n 1`
    mpi_env=""
    exeName=""
    defs=""
    buildType="RelWithDebInfo"

    ARGS=`getopt -o hj:n:i:s:e:m:b:N:d: --long jobName:,ncpus:,ncpu:,jobFile:,input:,softDir:,exe:,mpi:,mpi_env:,build:nnodes:definition: -n 'example.sh' -- "$@"`
    if [ $? != 0 ]; then echo "Terminating..."; return 1; fi
    eval set -- "${ARGS}"


    while true
    do
    #    echo "first $1, second is $2"
    case "$1" in
        -h)
            echo "No help message for you!"
            return 1;
            shift
            ;;
        -j|--jobName)
            jobName=$2
            shift 2
            ;;
        -n|--ncpus|--ncpu)            
            ncpus=$2
            shift 2
            ;;
        -N|--nnodes)            
            nnodes=$2
            shift 2
            ;;
        -i|--jobFile|--input)
            jobFile=$2
            shift 2
            ;;
        -s|--softDir)
            softDir=$2
            shift 2
            ;;
        -e|--exe)
            exeName=$2
            shift 2
            ;;
        -m|--mpi|mpi_env)
            mpi_env=$2
            shift 2
            ;;
        -b|--build)
            buildType=$2
            shift 2
            ;;
        -d|--definition)
            defs="-D$2 $defs"
            shift 2
            ;;
         --)
            shift
            break
            ;;
         *)
            echo "Internal erro!! $1"
            return 1;
            ;;
        esac
    done

    soft=` basename ${softDir}`
    job=`echo ${jobFile##*/}`
#   rm $job > /dev/null 2>&1; 
    \cp $jobFile  $job;
    cd $softDir > /dev/null;
    hash=`git log -1 --oneline | cut -d " " -f 1`
    if [[ $exeName == "" ]]; then
        if [[ $mpi_env == "" ]]; then
            me=""
            if [[ $buildType == "RelWithDebInfo" ]]; then exeName=${soft}-$hash; bt=""; else exeName=${soft}-$hash-${buildType}; bt="-b ${buildType}"; fi
        else
            me="-m $mpi_env"
            if [[ $buildType == "RelWithDebInfo" ]]; then exeName=${soft}-$hash-$mpi_env; bt=""; else exeName=${soft}-$hash-$mpi_env-${buildType}; bt="-b ${buildType}"; fi
        fi
        if [[ $defs != "" ]];then exeName="$exeName`echo $defs | sed "s/ //g" | sed "s/=/_/g"`"; fi
    fi
    
    gdFile=`echo ${exeName}.gd | sed "s/${soft}-//g"`
    if [[  -f $gdFile ]]; then
        rm $gdFile
    fi
    git diff --color-words  > $gdFile
    \mv $gdFile $curDir

    exeDir=${softDir}/bin;
    if [[ ! -f $exeDir/$exeName ]]; then
        mkdir -p build
        cd build 
        rm * -rf;
        sev $mpi_env >> /dev/null;
        cmake ../ -DCMAKE_BUILD_TYPE=${buildType} -DPARADIS_EXE=$exeName $defs && make -j12 && make install
        cd ../
        if [[ ! -f $exeDir/$exeName ]]; then return 1; fi;
    fi
    cd $curDir > /dev/null;

    sed -i "/^mpi_env/cmpi_env=$mpi_env" $job
    sed -i "/^exeDir=/cexeDir=$exeDir" $job
    sed -i "/^exeName=/cexeName=$exeName" $job
    sed -i "/^mqsub /cmqsub -j ${jobName} -n ${ncpus} -N $nnodes -i ${jobFile} -s ${softDir} $me $bt -e ${exeName}" $job
    sed -i "/^\#BSUB -R \"span\[ptile/c\#BSUB -R \"span[ptile=$ncpus]\"" $job
            
    jsubInfo=`sbatch -J ${jobName} --ntasks-per-node ${ncpus} -q normal -N $nnodes < ./${job}`
    echo "${jsubInfo}"
    jobID=`echo $jsubInfo | cut -d " " -f 4`
    echo "jobID=${jobID}: jobName=$jobName, ctrlFile=${ctrlFile}, dataFile=$dataFile numCpus=$ncpus, numNodes=$nnodes log=paradis-${jobID}.log, dir=$curDir";
    printf "%5d %3d %25s %s %s\n" ${jobID} $(echo "$ncpus*${nnodes}" | bc) $jobName $curDir $hash >> ${qLogFile};
    printf "%5d %3d %25s %s %s\n" ${jobID} $(echo "$ncpus*${nnodes}" | bc) $jobName $curDir $hash >> ${qHisFile};
    return 0;
}

function CycleInformation () {
    interval=0
    cycleInfo=-
    if [[ -f $exeDir/$logFile ]]; then
        lastTwo=`grep "\<cycle=" $exeDir/$logFile | tail -n 2`
        t0=`echo $lastTwo | cut -d " " -f 4-8`
        t1=`echo $lastTwo | cut -d " " -f 12-16`
        now=`date -d "$t1" +%Y-%m-%d:%H:%M:%S 2> /dev/null`
        if [[ $now == "" ]]; then now=-; fi
        c0=`echo $lastTwo | cut -d " " -f 1 | cut -d "=" -f 2`
        cycle=`echo $lastTwo | cut -d " " -f 9 | cut -d "=" -f 2`
        realdt=`echo $lastTwo | cut -d " " -f 10 | cut -d "=" -f 2`
        timeNow=`echo $lastTwo | cut -d " " -f 11 | cut -d "=" -f 2`
        cycleInfo="$(printf "%-10d %-10.3e %-10.3e %-20s" $cycle $realdt $timeNow "$now" 2>/dev/null)"
        
        if [[ ${t0} != "" && ${t1} != "" ]]; then
             T0=`date -d "${t0}" +%s 2>/dev/null`
             T1=`date -d "${t1}" +%s 2>/dev/null`
             if [[ ${T0} != "" && ${T1} != "" ]]; then
                 interval=`echo "scale=3;(${cycle}-${c0})/(${T1} - ${T0})" | bc -l 2>/dev/null`
             fi
        fi
    else
        cycleInfo=-
    fi
}

function qstat () {
    echo "jobID      nCpus      jobName                                            stn_%      str_MPa    pStn_%     cycle      realdt_s   timeNow_s  date                 freq_Hz"
    if [[ $# -eq 1 ]]; then
        if [ "$1" -gt 0 ] 2>/dev/null ; then
            qid=$1
            nqid=`printf "%5d" $qid`;
            info=`sed -n "/m ${qid}/p" ${qLogFile}`
            if [[ ${info} == "" ]]; then 
                color=31;
            else
                color=32;
             fi
            info=`sed -n "/^${nqid}/p" $qHisFile`; 
            if [[ ${info} ]]; then
                logFile=paradis-${qid}.log
                nCores=`echo $info | cut -d " " -f 2`
                nJobName=`echo $info | cut -d " " -f 3`
                exeDir=`echo $info | cut -d " " -f 4`
                if [[ ! -d $exeDir ]] ;then
                    sed -i "/^${nqid}/d" $qHisFile;
                    echo "Job ${nqid} is deleted";
                else
                    strain=`printf "%-7s" -`
                    stress=`printf "%-7s" -`
                    pstain=`printf "%-7s" -`
                    if [[ `find ${exeDir} -type d -name "res.*-${qid}"` ]]; then
                        ssFile=`find ${exeDir}/res.*-${qid} -type f -name "stress_Total_strain.plt"`
                        if [[ -f ${ssFile} ]] ; then 
                            ssInfo=`tail $ssFile -n 1`;
                            value=`echo $ssInfo | cut -d " " -f 2`;
                            strain=`printf "%-7.3f" $value`
                            value=`echo $ssInfo | cut -d " " -f 3`;
                            stress=`printf "%-7.3f" $value`
                            value=`echo $ssInfo | cut -d " " -f 4`;
                            pstrain=`printf "%-7.3f" $value`
                            if [[ `echo "${pstrain}>0.2" | bc -l` -eq 1 ]]; then if [[ ${color} == "32" ]]; then color=36; else color=35; fi; fi
                        fi
                    fi

                    CycleInformation
                    printf "\033[0;${color}m%-10d %-10d %-50s %-10s %-10s %-10s %-44s %-10.3f\033[0;0m \n" ${nqid} ${nCores} ${nJobName} ${strain} ${stress} ${pstrain} "${cycleInfo}" ${interval} 
                    cd $exeDir
                fi
            fi
        else
            array=()
            qids=`cat ${qHisFile} | while read line; do echo ${line} | cut -d " " -f 1; done`
            for qid in ${qids}; do
                nqid=`printf "%5d" $qid`;
                info=`sed -n "/^${nqid}/p" $qHisFile`
                if [[ $info == *${1}* ]]; then 
                    exeDir=`echo $info | cut -d " " -f 4`
                    array+=($exeDir-#$qid)
                fi
            done
            sortIDs=`for ((ii=0;ii<${#array[*]};ii++)); do echo ${array[$ii]}; done | sort -n | cut -d "#" -f 2`

#           runningJobIDs=`bjobs | grep paradiscmd | grep RUN | cut -d " " -f 1 | sort -n`
            runningJobIDs=`squeue | grep "normal" | grep " R " | sed "s/^[[:space:]]*//g" | cut -d " " -f 1 | sort -n`
            pendJobIDs=`squeue | grep "normal" | grep " PD" | sed "s/^[[:space:]]*//g" | cut -d " " -f 1 | sort -n`
            for qid in ${sortIDs}; do
                nqid=`printf "%5d" $qid`;
                info=`sed -n "/^${nqid}/p" $qHisFile`
                logFile=paradis-${qid}.log
                nCores=`echo $info | cut -d " " -f 2`
                nJobName=`echo $info | cut -d " " -f 3`
                exeDir=`echo $info | cut -d " " -f 4`
                
                if [[ $runningJobIDs == *${qid}* ]]; then color=32; elif [[ $pendJobIDs == *${qid}* ]]; then color=33; else color=31; fi;
                if [[ -d ${exeDir} ]]; then
                    strain=`printf "%-7s" -`
                    stress=`printf "%-7s" -`
                    pstain=`printf "%-7s" -`
                    if [[ `find ${exeDir} -type d -name "res.*-${qid}"` ]]; then
                        ssFile=`find ${exeDir}/res.*-${qid} -type f -name "stress_Total_strain.plt"`
                        if [[ -f ${ssFile} ]] ; then 
                            ssInfo=`tail $ssFile -n 1`;
                            value=`echo $ssInfo | cut -d " " -f 2`;
                            strain=`printf "%-7.3f" $value`
                            value=`echo $ssInfo | cut -d " " -f 3`;
                            stress=`printf "%-7.3f" $value`
                            value=`echo $ssInfo | cut -d " " -f 4`;
                            pstrain=`printf "%-7.3f" $value`
                            if [[ `echo "${pstrain}>0.2" | bc -l` -eq 1 ]]; then if [[ ${color} == "32" ]]; then color=36; else color=35; fi; fi
                        else 
                            color="34" 
                        fi
                    else
                        if [[ $color == "31" ]]; then sed -i "/^${nqid}/d" $qHisFile; fi;
                    fi

                    CycleInformation
                    if [[  -f $exeDir/$logFile ]]; then
                        if [[ `find $exeDir -type d -name "res.*-${qid}"` == "" ]]; then
                            if [[ $color == "31" || $color == "35" ]]; then
                                rm $exeDir/$logFile $exeDir/paradis-${qid}.err
                            fi
                        fi
                    fi
                    printf "\033[0;${color}m%-10d %-10d %-50s %-10s %-10s %-10s %-44s %-10.3f\033[0;0m \n" ${nqid} ${nCores} ${nJobName} ${strain} ${stress} ${pstrain} "${cycleInfo}" ${interval} 
                else
                    echo "delete: $nqid $info"
                    sed -i "/^${nqid}/d" $qHisFile;
                fi
            done
        fi
        return 0;
    fi

    rm ${qLogFile}.bak > /dev/null 2>&1;
    array=()
    for qid in `squeue | grep "normal" | grep " R " | sed "s/^[[:space:]]*//g" | cut -d " " -f 1 | sort -n`; do
        nqid=`printf "%5d" $qid`;
        if [[ `grep "\<${nqid}\>" $qHisFile` != "" ]]; then
            info=`sed -n "/^${nqid}/p" $qHisFile`
            nJobName=`echo $info | cut -d " " -f 3`
            exeDir=`echo $info | cut -d " " -f 4`
            array+=($nJobName-#$qid)
        fi
    done
    sortIDs=`(for ((ii=0;ii<${#array[*]};ii++)); do echo ${array[$ii]}; done) | sort -n | cut -d "#" -f 2`

    ncpus=0;
    for qid in ${sortIDs}; do
        nqid=`printf "%5d" $qid`;
        info=`sed -n "/^${nqid}/p" $qHisFile`
        logFile=paradis-${qid}.log
        nCores=`echo $info | cut -d " " -f 2`
        ((ncpus+=${nCores}));
        nJobName=`echo $info | cut -d " " -f 3`
        exeDir=`echo $info | cut -d " " -f 4`
        color=32; if [[ ${info} == "" ]]; then info=`sed -n "/^${nqid}/p" $qHisFile`; color=31; fi

        strain=`printf "%-7s" -`
        stress=`printf "%-7s" -`
        pstain=`printf "%-7s" -`
        if [[ `find ${exeDir} -type d -name "res.*-${qid}"` ]]; then
            ssFile=`find ${exeDir}/res.*-${qid} -type f -name "stress_Total_strain.plt"`
            if [[ -f ${ssFile} ]] ; then 
                ssInfo=`tail $ssFile -n 1`;
                value=`echo $ssInfo | cut -d " " -f 2`;
                strain=`printf "%.3f" $value`
                value=`echo $ssInfo | cut -d " " -f 3`;
                stress=`printf "%06.2f" $value`
                value=`echo $ssInfo | cut -d " " -f 4`;
                pstrain=`printf "%.3f" $value`
                if [[ `echo "${pstrain}>0.2" | bc -l` -eq 1 ]]; then if [[ ${color} == "32" ]]; then color=36; else color=35; fi; fi
            fi
        fi
        
        CycleInformation
        printf "\033[0;${color}m%-10d %-10d %-50s %-10s %-10s %-10s %-44s %-10.3f\033[0;0m \n" ${nqid} ${nCores} ${nJobName} ${strain} ${stress} ${pstrain} "${cycleInfo}" ${interval} 
        printf "\033[0;${color}m%-10d %-10d %-50s %-10s %-10s %-10s %-44s %-10.3f\033[0;0m \n" ${nqid} ${nCores} ${nJobName} ${strain} ${stress} ${pstrain} "${cycleInfo}" ${interval}  >> ${qLogFile}.bak
    done
    echo "$ncpus cores are now in use!"
    if [[ -f ${qLogFile} ]] ; then
        rm $qLogFile
        mv ${qLogFile}.bak  $qLogFile > /dev/null 2>&1;
    fi
}
function qlog () { cat $qLogFile; }
function qdel () {
    for qid in "$*"; do
        nqid=`printf "%5d" $qid`;
        info=`sed -n "/^${nqid}/p" $qHisFile`
        exeDir=`echo $info | cut -d " " -f 4`
        echo "$info"
        rm ${exeDir}/host* > /dev/null 2>&1;
        scancel $qid
    done
}

function qdel-f () {
    for qid in "$*"; do
        qstat $qid;
        nqid=`printf "%5d" $qid`;
        info=`sed -n "/^${nqid}/p" $qHisFile`
        exeDir=`echo $info | cut -d " " -f 4`
        if [[ -d $exeDir ]]; then
            rm ${exeDir}/host* > /dev/null 2>&1;
            touch ${exeDir}/Finish
        fi
        scancel $qid
    done
}


